home *** CD-ROM | disk | FTP | other *** search
- |* sunSubr.s --
- |*
- |* Contains misc. assembler routines for the SUN.
- |*
- |* Copyright (C) 1985 Regents of the University of California
- |* All rights reserved.
- |*
- |* rcs = $Header: /cdrom/src/kernel/Cvsroot/kernel/sys/sysSubr.s.old,v 9.0 89/09/12 15:20:22 douglis Stable $ SPRITE (Berkeley)
- |*
-
- #include "machConst.h"
- #include "asmDefs.h"
-
- |*---------------------------------------------------------------------
- |*
- |* Sys_SetIntrLevel --
- |*
- |* Enables interrupts of a certain level and above.
- |* Input is a mask which specifies the interrupt level.
- |*
- |* Results:
- |* The mask of the interrupt level
- |*
- |* Side effects:
- |* Interrupts may be enabled or disabled.
- |* Trace bit is always set to 0.
- |*
- |*---------------------------------------------------------------------
-
- .text
- .globl _Sys_SetIntrLevel
- _Sys_SetIntrLevel:
- link a6,#0
- movl a6@(8),d1 | copy argument to d1
-
- | input error check:
- andw #MACH_SR_INTMASK,d1 | make sure the arg. has just
- | the interrupt bits set.
-
- orw #MACH_SR_SUPSTATE,d1 | set the supervisor state bit
-
- clrl d0
- movw sr,d0 | save status register in d0
- andw #MACH_SR_INTMASK,d0 | return previous interrupt level mask
-
- movw d1,sr | put new value in status register
- unlk a6
- rts
-
- #define SAVED_REGS 0xFCFC
-
- |*
- |* ----------------------------------------------------------------------
- |*
- |* SysSetJump --
- |*
- |* Prepare for a non-local goto (i.e. Sys_LongJump). This saves the
- |* program counter and all local registers in the given Sys_SetJumpState
- |* struct.
- |*
- |* SysSetJump(setJumpStatePtr)
- |* Sys_SetJumpState *setJumpStatePtr;
- |*
- |* Results:
- |* None.
- |*
- |* Side effects:
- |* None.
- |*
- |* ----------------------------------------------------------------------
- |*
-
- .globl _SysSetJump
- _SysSetJump:
- movl sp@(4),a0 | Get the address of where to store the
- | registers in a register.
- moveml #SAVED_REGS,a0@(4) | Save registers.
- movl sp@,a0@ | Save program counter of caller.
- clrl d0 | Return zero
- rts
-
- |*
- |* ----------------------------------------------------------------------
- |*
- |* Sys_LongJump --
- |*
- |* Prepare for a non-local goto (i.e. Sys_LongJump). This saves the
- |* program counter and all local registers in the given Sys_SetJumpState
- |* struct.
- |*
- |* Results:
- |* None.
- |*
- |* Side effects:
- |* None.
- |*
- |* ----------------------------------------------------------------------
- |*
-
- .globl _Sys_LongJump
- _Sys_LongJump:
- movl sp@(4),a0 | Get address of saved state.
- moveml a0@(4),#SAVED_REGS | Restore registers (this causes the
- | stack to be changed).
- movl a0@,sp@ | Push the program counter onto the
- | stack.
- movl #1,d0 | Return FAILURE.
- rts
-